<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'site-news-form',
    'enableAjaxValidation' => false,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
?>
<div class="block">
    <div class="alert alert_grey">
        <img height="24" width="24" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/grey/alert_2.png">
        Fields with <span class="required"><strong>*</strong></span> are required.
    </div>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="input_group">
        <?php echo $form->labelEx($model, 'news_category_id'); ?>
        <?php echo $form->dropDownList($model, 'news_news_category_id', CHtml::listData(site_news_category::model()->findAll(), 'news_category_id', 'news_category_title'), array('prompt' => 'Please Select Category')); ?>
        <?php //echo $form->error($model, 'news_category_id'); ?>
    </div>

    <?php echo $form->labelEx($model, 'news_source'); ?>
    <?php echo $form->textField($model, 'news_source', array('size' => 60, 'maxlength' => 255)); ?>
    <?php //echo $form->error($model, 'news_source'); ?>

    <?php echo $form->labelEx($model, 'news_title'); ?>
    <?php echo $form->textField($model, 'news_title', array('size' => 60, 'maxlength' => 100)); ?>
    <?php //echo $form->error($model, 'news_title'); ?>

    <?php echo $form->labelEx($model, 'news_subtitle'); ?>
    <?php echo $form->textField($model, 'news_subtitle', array('size' => 60, 'maxlength' => 100)); ?>
    <?php //echo $form->error($model, 'news_subtitle'); ?>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'news_short_content'); ?>
        <?php
        $this->widget('application.extensions.ckeditor.CKEditor', array(
            "model" => $model,
            "attribute" => 'news_short_content',
            "width" => '100%',
            "toolbar" => "Basic",
                )
        );
        ?>
        <?php //echo $form->error($model, 'news_short_content'); ?>
    </div>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'news_content'); ?>
        <?php
        $this->widget('application.extensions.ckeditor.CKEditor', array(
            "model" => $model,
            "attribute" => 'news_content',
            "width" => '100%',
            "toolbar" => "Basic",
                )
        );
        ?>
        <?php //echo $form->error($model, 'news_content'); ?>
    </div>
    
    <div class="input_group">
        <?php echo $form->labelEx($model, 'news_image'); ?>
        <?php
        if(!$model->isNewRecord && $model->news_image != null) {
            echo '<div>'.CHtml::image(Yii::app()->params['config']['dir']['news'].$model->news_image, (($model->news_image != null) ? $model->news_title : ''), array('width' => 100)).'</div>';
        }
        ?>
        <?php echo CHtml::activeFileField($model, 'news_image'); ?>
        <?php //echo $form->error($model, 'news_image'); ?>
    </div>
    
    <?php echo $form->labelEx($model, 'news_tag'); ?>
    <?php echo $form->textArea($model, 'news_tag', array('cols' => 80, 'rows' => 2)); ?>
    <?php //echo $form->error($model,'news_tag'); ?>

    <button class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/white/bended_arrow_right.png"><span><?php echo ($model->isNewRecord) ? 'Create' : 'Save'; ?></span></button>

</div>

<?php $this->endWidget(); ?>
<!-- form -->